#include<bits/stdc++.h>
using namespace std;
int n,m,s,a[10001],k;
int main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);	
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(int i=0;i<n;i++)
    {
        if(a[i]>a[i+1])
            s++;
    }
    cout<<s;
    return 0;
}


